<!DOCTYPE html>
<html lang="en">
<meta name="format-detection" content="telephone=no"/>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="../script/api.js" type="text/javascript"></script>
<script src="../script/jquery.min.js" type="text/javascript"></script>
<script src="../script/ui.js"></script>
<body style="margin: 0px">
<div id='BarAppearance' style="height: 30px"></div>
</body>
</html>
<style>
    html,
    body {
        width: 100%;
        background-color: black;
    }

</style>
<script>
    var videoPlayer;
    var duration;
    apiready = function () {
        var topHeight=api.safeArea.top;
        $("#BarAppearance").css({
            'height':topHeight,
            'width':'100%',
            'background':'#000'
        });
        var y = $('#BarAppearance').height();
        videoPlayer = api.require('videoPlayer');
        videoPlayer.open({
            path:api.pageParam.path,
            rect: {
                x: 0,
                y: y,
                w: api.winWidth,
                h: api.winHeight - y
            },
            bg:"#000"
        }, function (ret, err) {
            if (ret.status && ret.eventType === "playing") {
                duration = ret.duration;
                console.log("dsa");
                api.execScript({
                    frameName: 'playerFrame',
                    script: 'init("' + duration + '");'
                });
            }
        });
        videoPlayer.addEventListener({
            name: 'play'
        }, function (ret, err) {
            if (ret.eventType == 'playing' && ret.current > 0) {
                api.execScript({
                    frameName: 'playerFrame',
                    script: 'fnprogressOpen("' + ret.current + '","' + duration + '");'
                });

            } else {

            }
        });
        api.openFrame({
            name: 'playerFrame',
            url: 'playerFrame.html',
            rect: {
                x: 0,
                y: y,
                w: 'auto',
                h: 'auto'
            }
        });
        api.addEventListener({
            name: 'keyback'
        }, function (ret, err) {
            api.closeWin();
            fnvunFull();
        });
    };
</script>
<script>
    function fnvPlay() {
        videoPlayer.start();
    }

    function fnvPause() {
        videoPlayer.pause();
    }

    function fnvFull() {
        videoPlayer.fullScreen();
    }

    function fnvunFull() {
        videoPlayer.cancelFullScreen();
    }

    function seekTo(seconds) {
        videoPlayer.seekTo({
            seconds: parseInt(seconds)
        });
    }
</script>


